package com.sense.kukoo.biz_explore.vm

import android.util.Log
import androidx.lifecycle.MutableLiveData
import com.sense.kukoo.biz_explore.model.ExploreModel
import com.sense.kukoo.common.mvvm.model.BaseMvvmModel
import com.sense.kukoo.common.mvvm.vm.BaseViewModel
import com.sense.kukoo.common.repo.Repo
import com.sense.kukoo.common.repo.bean.IndexBean


class ExploreViewModel : BaseViewModel() {

    private val TAG: String = javaClass.simpleName
    val mIndex: MutableLiveData<IndexBean> = MutableLiveData()

    override fun createModel(): BaseMvvmModel? = null

    override fun initData() {}

    //获取频道栏
    fun getIndex() {
        toView(ACTION_SHOW_DIALOG)
        request {
            val result = Repo.http.index()
            if (result.success) {
                val index: IndexBean = result.data!!
                mIndex.postValue(index)
            } else {
                Log.e(TAG, "result=" + result.msg)
                result.msg.let { sendHintMessage(it) }
            }
            toView(ACTION_HIDE_DIALOG)
        }
    }

}